//
//  AfterSaleCell.m
//  FKGW
//
//  Created by song ce on 2017/3/10.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "AfterSaleCell.h"

@implementation AfterSaleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle= UITableViewCellSelectionStyleNone;
}
- (IBAction)afterSale:(UIButton *)sender {
    NSDictionary *dic = @{@"service":sender.currentTitle,
                          @"key":[NSString stringWithFormat:@"%ld",sender.tag]
                          };
    [[NSNotificationCenter defaultCenter]postNotificationName:@"service" object:dic];
    sender.selected = !sender.selected;
    if(sender.isSelected){
        [sender setImage:[UIImage imageNamed:@"icon_fuxuankuang_sel"] forState:UIControlStateNormal];
    }else{
        [sender setImage:[UIImage imageNamed:@"icon_fuxuankuang_nor"] forState:UIControlStateNormal];
    }
}

-(void)setModel:(TagCellModel *)model{
    _model = model;
    NSArray *services = _model.services;
    for(int i=0;i<services.count;i++){
        NSString *ser = services[i];
        for(int j=0;j<self.btns.count;j++){
            UIButton *btn = self.btns[j];
            if([btn.currentTitle isEqualToString:ser ]){
                [btn setImage:[UIImage imageNamed:@"icon_fuxuankuang_sel"] forState:UIControlStateNormal];
                btn.selected = YES;
            }
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
